<?php
include("../include/config.inc.php");
include("userlogincheck.php");

$sql="select * from ".tableprefix."member where member_state='1' and member_id=$userid";
$result=$db->query($sql);
$row=$db->fetch_array($result);
$db->free_result($result);

$sql = "select count(*) as count from ".tableprefix."store where member_id='$userid'";
$rs=$db->fetch_array($db->query($sql));
$count=$rs["count"];
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>用户中心 - 订戏会</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=9,Chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet" type="text/css" href="../css/public.css">
<link rel="stylesheet" type="text/css" href="../css/user.css">
<script type="text/javascript" src="../js/clientwidth.js"></script>
</head>

<body>
<section class="container">
        <div class="personal-head">
            <img alt="" src="<?php if($row["member_avatar"]==''){echo "../images/mobile_user_avatar.png";}else{echo $row["member_avatar"];}?>">
            <div class="p-head-info">
                <p class="p-nickname"><?php echo $row["member_name"];?></p>
				<p class="p-platform"><?php echo $row["member_mobile"];?>(个人用户)</p>
            </div>
        </div>
        <div class="personal-orders">
            <div class="p-orders">
                <span class="p-all-orders">我的订单</span>
                <span class="p-all-orders-span"><a href="orders.php">查看全部</a></span>
            </div>
            <div class="personal-wrapper-orders">
                <a href="orders.php?a=unpay">
				<div class="p-wrapper-orders-item">
                    <em class="p-unpaid"></em>
                    <p>待付款</p>
                </div>
				</a>
				<a href="orders.php?a=unship">
                <div class="p-wrapper-orders-item">
                    <em class="p-unshipping"></em>
		            <p>待发货</p>
                </div>
				</a>
				<a href="orders.php?a=unrec">
                <div class="p-wrapper-orders-item">
 					<em class="p-unreceived"></em>
                    <p>待收货</p>
                </div>
				</a>
				<a href="orders.php?a=unrat">
                <div class="p-wrapper-orders-item">
                    <em class="p-unrated"></em>
                    <p>待评价</p>
                </div>
				</a>
				<a href="orders.php?a=Refund">
				<div class="p-wrapper-orders-item">
					<em class="p-grouping"></em>
                    <p>退款/售后</p>
                </div>
				</a>
            </div>
        </div>
        <div class="personal-wrapper">
            <a href="">
			<div class="p-wrapper-item">
                <em class="p-messages"></em>
                <p>我的消息</p>
            </div>
			</a>
			<a href="fenxiao.php">
            <div class="p-wrapper-item">
                <em class="p-coupons"></em>
                <p>我的分销</p>
            </div>
			</a>
			<a href="collection.php">
            <div class="p-wrapper-item">
                <em class="p-likes"></em>
                <p>我的收藏</p>
            </div>
			</a>
			<a href="troupe.php">
            <div class="p-wrapper-item">
                <em class="p-store"></em>
                <p>关注的店铺</p>
            </div>
			</a>
        </div>
		
        <div class="personal-list">
            <ul>
                <!--<a href="address.php">
				<li>
                    <em class="p-addresses"></em>
					<p>收货地址</p>
					<b class="right"><i class="right-arrow1"></i><i class="right-arrow2"></i></b>
                </li>
				</a>-->
				<?php if($count==0){?>
				<a href="../publish/store-reg.php">
				<li>
                    <em class="p-addresses"></em>
					<p>院团入驻</p>
					<b class="right"><i class="right-arrow1"></i><i class="right-arrow2"></i></b>
                </li>
				</a>
				<?php }else{?>
				<a href="../user/seller.php">
				<li>
                    <em class="p-addresses"></em>
					<p>院团中心</p>
					<b class="right"><i class="right-arrow1"></i><i class="right-arrow2"></i></b>
                </li>
				</a>
				<?php }?>
            </ul>
        </div>
		
		<div class="personal-list">
            <ul>
				<a href="set.php">
                <li>
                    <em class="p-setting"></em>
					<p>设置</p>
					<b class="right"><i class="right-arrow1"></i><i class="right-arrow2"></i></b>
                </li>
				</a>
            </ul>
        </div>
        <div class="personal-space p-space-2"></div>
    </section>
<div id="bottom"></div>

<footer id="bar-fixed">
	<a href="../" class="tab-item"><i class="icon-tabbar bar-home"></i>首页</a>
	<a href="../category.php" class="tab-item"><i class="icon-tabbar bar-message"></i>分类</a>
	<a href="../publish/" class="tab-item"><i class="icon-tabbar bar-publish"></i>发布</a>	
	<a href="../user/" class="tab-item active"><i class="icon-tabbar bar-user2"></i>我</a>
</footer>
<script>
if (document.body.clientWidth > 640) {
	$('body').css({
		width: 640,
		margin: '0 auto',
	});
}
</script>
</body>
</html>
<?php
$db->close();
exit;
?>